const express = require('express')
const router = express.Router()
const api = require('./api')
const upload = require('./uploadConfig')

router.post('/upload', upload.single('avatar'), (req, res, next) => {
  api.upload(req, res, next)
})

router.post('/register', (req, res, next) => {
  api.register(req, res, next)
})

router.post('/login', (req, res, next) => {
  api.login(req, res, next)
})

router.get('/getUserInfo', (req, res, next) => {
  api.getUserInfo(req, res, next)
})

router.get('/getArticleList', (req, res, next) => {
  api.getArticleList(req, res, next)
})

router.post('/addArticle', (req, res, next) => {
  api.addArticle(req, res, next)
})

module.exports = router
